package com.example.administrator.shuju;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.ListView;

import java.util.ArrayList;

public class MainActivity extends AppCompatActivity {

    //数据源
    private ArrayList<LianXiRen> list = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        //Listview
        ListView listView = (ListView)findViewById(R.id.listView);

        MyAdapter myAdapter = new MyAdapter(this,list);

        listView.setAdapter(myAdapter);

        intiData();
    }

    private void intiData() {
        LianXiRen lianXiRen = new LianXiRen();
        for (int i = 0;i < 20;i++) {
            lianXiRen.setName("名字：" + i);
            lianXiRen.setNumber("号码：" + i);
            lianXiRen.setSourceID(7);

            list.add(lianXiRen);
        }
    }
}
